package com.mpyy.handler.purchase;

import com.alibaba.fastjson.JSON;
import com.mpyy.pojo.PurchaseStock;
import com.mpyy.service.purchase.PurchaseStockInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;

/**
 * @version 1.0
 * @Description
 * @Author zhangkaibo
 * @Date 2022-03-09 16:25
 */
//查询进货信息，在根据进货单号，时间详细查询进货信息
@Controller
public class PurchaseStockHandler {
    //查询进货信息
    @Autowired
    private PurchaseStockInter purchaseStockInter;
    @RequestMapping(value = {"/searchPurchaseStock"})
    @ResponseBody
    public String searchPurchaseStock(PurchaseStock purchaseStock){
        System.out.println("调用查询方法");
        List<PurchaseStock> purchaseStocks =purchaseStockInter.searchPurchaseStock(purchaseStock);
        HashMap<Object, Object> inventoryCollectMap = new HashMap<>();
        System.out.println(purchaseStocks);
        inventoryCollectMap.put("code",0);
        inventoryCollectMap.put("msg","");
        inventoryCollectMap.put("count",purchaseStocks.size());
        inventoryCollectMap.put("data",purchaseStocks);
        return JSON.toJSONString(inventoryCollectMap);
    }
}
